<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width:200px;
            height:200px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <script>
        let box = document.querySelector(".box");
        box.onclick = function(e){
            console.log(e.clientX);  //在控制台输出box的x坐标
            console.log(e.clientY); //在控制台输出box的y坐标
        }
    </script>
</body>
</html>